# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgbase=cloud-utils
pkgname=(cloud-utils cloud-guest-utils cloud-image-utils)
pkgver=0.33
pkgrel=1
pkgdesc="Useful set of utilities for interacting with a cloud (meta package)"
url="https://github.com/canonical/cloud-utils"
arch=('any')
license=('GPL3')
source=("https://github.com/canonical/cloud-utils/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
b2sums=('92c42844a7c1f826d43c9a715e56d05c77d7b37c721079165ffb008205e412327e39ecba5d2755c84e2d80e4ee752ef95ce099da25625010327f957e419195d7')

package_cloud-utils() {
  depends=('cloud-guest-utils' 'cloud-image-utils')
}

package_cloud-guest-utils() {
  pkgdesc="Useful set of utilities for interacting with a cloud (cloud guests)"
  depends=('python')

  cd "${pkgbase}-${pkgver}"

  for bin in ec2metadata growpart vcs-run; do
    install -Dm 755 "bin/${bin}" -t "${pkgdir}/usr/bin"
  done

  install -Dm 644 "man/growpart.1" -t "${pkgdir}/usr/share/man/man1"
}

package_cloud-image-utils() {
  pkgdesc="Useful set of utilities for interacting with a cloud (cloud images)"
  depends=('python' 'ca-certificates' 'cdrtools' 'qemu-img' 'wget')

  cd "${pkgbase}-${pkgver}"

  for bin in cloud-localds mount-image-callback resize-part-image ubuntu-cloudimg-query write-mime-multipart; do
    install -Dm 755 "bin/${bin}" -t "${pkgdir}/usr/bin"
  done

  for man in cloud-localds resize-part-image write-mime-multipart; do
    install -Dm 644 "man/${man}.1" -t "${pkgdir}/usr/share/man/man1"
  done
}

# vim:set ts=2 sw=2 et:
